 
function gotoUrl(ifameName,pageContainerName,title) {
	findIframe(ifameName,pageContainerName);
	findPageContainer(pageContainerName,title);
}
function findIframe(ifameName,pageContainerName){
	var $iframes=$('iframe', parent.document);
    var flag=true;
	if($iframes){
		$.each($iframes,function(n,$value) {  
	    	var $temp=$($value);
	    	$temp.attr("style","display: none;");
           });  
		
	    $.each($iframes,function(n,$value) {  
	    	var $temp=$($value);
	    	if($temp.attr("name")==ifameName){
	    		flag=false;
	    		$temp.removeAttr("style");
	    	}
	      });  
	    if(flag){
	    	addIframe(ifameName,pageContainerName);
	    }
	}
	
}
function findPageContainer(name,title){
	var $a=$('#page-tabs-content-container>a', parent.document);
	   var flag=true;
    if($a){
    	$.each($a,function(n,$value) {  
	    	var $temp=$($value);
	    	$temp.attr("class","J_menuTab");
           });  
    	
	    $.each($a,function(n,$value) {  
	    	var $temp=$($value);
	    	if($temp.attr("data-id")==name){
	    	    flag=false;
	    	    $temp.attr("class","active J_menuTab");
	    	}
	    	
	    	
           });  
	    if(flag){
			addPageContainer(name,title);
	    }
	}
}
function addIframe(ifameName,pageContainerName){
var $iframes=$('#content-main', parent.document);
	var $v=$("<iframe></iframe>");
	$v.attr("class","J_iframe");
	$v.attr("name",ifameName);
	$v.attr("width","100%");
	$v.attr("height","100%");
	$v.attr("src",pageContainerName);
	$v.attr("frameborder","0");
	$v.attr("data-id",pageContainerName);
	$v.attr("seamless","");
    $iframes.append($v);
}
function addPageContainer(name,title){
    var $pageContent=$('#page-tabs-content-container', parent.document);
	var $v=$("<a>"+title+"</a>");
	$v.attr("href","javascript:;");
	$v.attr("class","active J_menuTab");
	$v.attr("data-id",name);
	var $i=$("<i></i>");
	$i.attr("class","fa fa-times-circle");
	$v.append($i);
	$pageContent.append($v);
}

